package com.ruoyi.bussine.common.enums.user;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author zhengyz
 * @date 2025/3/14
 */
@Getter
@AllArgsConstructor
public enum UserTypeEnum {

    //    消费者
    CONSUMER("consumer", ProgramTypeEnum.CONSUMER, "消费者"),
    //    门店
    STORE_MANAGER("store_manager", ProgramTypeEnum.STORE, "门店店长"),
    //    服务员
    STORE_WAITER("store_waiter", ProgramTypeEnum.STORE, "服务员"),
    //    司机
    SERVER_DRIVER("server_driver", ProgramTypeEnum.SERVER, "司机"),
    //    仓库
    SERVER_WAREHOUSE("server_warehouse", ProgramTypeEnum.SERVER, "仓库"),
    //    供应商
    SUPPLIER("supplier", ProgramTypeEnum.SUPPLIER, "供应商"),
    // 业务员
    SUPPLIER_PROMOTER("supplier_promoter", ProgramTypeEnum.SUPPLIER, "业务员"),

    OTHER("", null, "未知"),
    ;


    private String value;
    private ProgramTypeEnum programTypeEnum;
    private String desc;

    public static boolean isExist(String value) {
        for (UserTypeEnum userTypeEnum : UserTypeEnum.values()) {
            if (userTypeEnum.getValue().equals(value)) {
                return true;
            }
        }
        return false;
    }

    public static UserTypeEnum getUserTypeEnum(String value) {
        for (UserTypeEnum userTypeEnum : UserTypeEnum.values()) {
            if (userTypeEnum.getValue().equals(value)) {
                return userTypeEnum;
            }
        }
        return OTHER;
    }

}
